﻿using Glue;
using Glue.Internals;
using GlueTests.Builders;
using Xunit;

namespace GlueTests.RelationContainerTests
{
    public class When_requesting_a_non_existent_relation
    {
        private readonly RelationContainer<DomainPerson, GuiPerson> container;

        public class GuiPerson { public int Id { get; set; } }
        public class DomainPerson { public int Id { get; set; } }

        

        public When_requesting_a_non_existent_relation()
        {
            container = new RelationContainer<DomainPerson, GuiPerson>(new ObjectMemberFactoryBuilder().Build());
        }

        [Fact]
        public void Should_throw_exception_if_not_exist()
        {
            Assert.Throws(typeof(GlueException),()=>container.Get(domain => domain.Id, gui => gui.Id));
        }

        [Fact]
        public void Removing_should_throw_exception()
        {
            Assert.Throws(typeof(GlueException),()=>container.Remove(domain=>domain.Id,gui=>gui.Id));
        }
    }
}
